var o,
  t = require("../../res/www.a9a.cn.js"),
  n = getApp();
Page({
  data: { mask_class: "alpha0_100", bg: n.WWW + "/res/m/img/my_bg.png" },
  onLoad: function (o) {
    var i = this,
      a = this,
      e = o.id;
    a.setData({ id: e }),
      n.get_config("_ZEAI").then(function (o) {
        a.setData({ color: n._ZEAI.color, rgbcolor: t.c16_rgb(n._ZEAI.color) }),
          wx.setNavigationBarColor({
            backgroundColor: n._ZEAI.color,
            frontColor: "#ffffff",
          }),
          wx.setBackgroundColor({ backgroundColorTop: n._ZEAI.color });
      }),
      n.get_openid().then(function (o) {
        i.init();
      });
  },
  init: function () {
    var i = this;
    wx.showLoading({ title: "拼命加载中...", mask: !0 }),
      wx.showNavigationBarLoading(),
      (o = wx.getStorageSync("COOK_U")),
      n.ajax({
        url: "hn.php",
        data: { submitok: "hn_detail_new", openid: o.openid, id: i.data.id },
        success: function (o) {
          1 == o.flag
            ? (i.setData({
                D: o.D,
                aboutus: t.escape2Html(o.D.aboutus),
                BBS: o.BBS,
                ANLI: o.ANLI,
              }),
              wx.setNavigationBarTitle({ title: o.D.nTitle }),
              wx.setBackgroundColor({ backgroundColorTop: i.data.color }))
            : wx.showToast({ title: o.msg, icon: "none", mask: !0 }),
            wx.hideLoading(),
            wx.hideNavigationBarLoading();
        },
      });
  },
  telFn: function (o) {
    wx.makePhoneCall({ phoneNumber: this.data.D.mob });
  },
  bbs_addFn: function () {
    var o = this;
    n.chklogin().then(function (t) {
      t ? o.setData({ div_bbs: !0 }) : wx.redirectTo({ url: "../login/login" });
    });
  },
  bbsshowFn: function () {
    t.o("#bbsbox", function (o) {
      wx.pageScrollTo({ scrollTop: o[0].top - 20, duration: 300 });
    });
  },
  div_bbs_submitFn: function (i) {
    var a = this,
      e = i.detail.value;
    n.empty(e.content)
      ? wx.showToast({ title: "请输入评价内容", icon: "none", mask: !0 })
      : wx.showModal({
          title: "",
          content:
            "确定提交么？\r\n以下情形话题将被删除或封号：\r\n《请勿留下任何形式联系方法》\r\n《请勿发表涉黄涉政言论》\r\n《不得辱骂或攻击他人》",
          confirmColor: a.data.color,
          cancelText: "取消",
          confirmText: "确定",
          success: function (i) {
            i.confirm &&
              (wx.showLoading({ title: "正在保存", mask: !0 }),
              n.ajax({
                url: "hn.php",
                data: {
                  submitok: "bbs_add",
                  openid: o.openid,
                  id: a.data.id,
                  content: e.content,
                  kind: e.kind,
                },
                success: function (o) {
                  wx.hideLoading(),
                    1 == o.flag
                      ? wx.showModal({
                          content: o.msg,
                          confirmColor: a.data.color,
                          confirmText: "朕知道了",
                          showCancel: !1,
                          success: function (o) {
                            a.setData({ div_bbs: !1 }), a.init();
                          },
                        })
                      : ((o.this = a), (o.url = "no"), t.sorry(o));
                },
              }));
          },
        });
  },
  join_addFn: function () {
    var i = this;
    n.chklogin().then(function (a) {
      a
        ? wx.showModal({
            title: "",
            content:
              "确定【" +
              i.data.D.truename +
              "】为您服务么？\r\n选定后将不能更换",
            confirmColor: i.data.color,
            cancelText: "取消",
            confirmText: "确定",
            success: function (a) {
              a.confirm &&
                (wx.showLoading({ title: "正在发送申请", mask: !0 }),
                n.ajax({
                  url: "hn.php",
                  data: {
                    submitok: "join_add",
                    openid: o.openid,
                    id: i.data.id,
                  },
                  success: function (o) {
                    wx.hideLoading(),
                      1 == o.flag
                        ? wx.showModal({
                            content: o.msg,
                            confirmColor: i.data.color,
                            confirmText: "朕知道了",
                            showCancel: !1,
                            success: function (o) {
                              i.init();
                            },
                          })
                        : ((o.this = i), (o.url = "no"), t.sorry(o));
                  },
                }));
            },
          })
        : wx.redirectTo({ url: "../login/login" });
    });
  },
  getPhoneNumber: function (o) {
    n.getPhoneNumber({ e: o, url: "../reg/reg" });
  },
  back: function () {
    this.setData({ div_login: !1 });
  },
  kefu_closeFn: function () {
    this.setData({ div_bbs: !1 });
  },
  anliFn: function () {
    t.o("#anlibox", function (o) {
      wx.pageScrollTo({ scrollTop: o[0].top - 20, duration: 300 });
    });
  },
  onPullDownRefresh: function () {
    var o = this;
    wx.vibrateShort({ type: "heavy" }),
      setTimeout(function () {
        wx.stopPullDownRefresh(), o.init();
      }, 500);
  },
  onShareAppMessage: function () {
    return {
      imageUrl: this.data.D.path_s,
      title: this.data.D.truename,
      path: "/pages/hn/hn_detail?id=" + this.data.id,
    };
  },
  onShareTimeline: function () {
    return {
      imageUrl: this.data.D.path_s,
      title: this.data.D.truename,
      query: "id=" + this.data.id,
      path: "/pages/hn/hn_detail",
    };
  },
  ifagreeFn: function (o) {
    1 == o.detail.value
      ? this.setData({ ifagree: !0 })
      : this.setData({ ifagree: !1 });
  },
  ifagree_passFn: function () {
    wx.showToast({
      title: "请先点击同意《用户协议》和《隐私条款》",
      icon: "none",
      mask: !0,
      duration: 3e3,
    });
  },
});
